﻿@using Microsoft.AspNetCore.Identity
@inject SignInManager<IdentityUser> SignInManager
@inject UserManager<IdentityUser> UserManager

@if (SignInManager.IsSignedIn(User))
{
    <ul class="navbar-nav">
        <li class="nav-item">
            <span class="nav-link">欢迎，@User.Identity?.Name</span>
        </li>
        <li class="nav-item">
            <form asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Page("/Index")" method="post" class="d-inline">
                <button type="submit" class="nav-link btn btn-link">注销</button>
            </form>
        </li>
    </ul>
}
else
{
    <ul class="navbar-nav">
        <li class="nav-item">
            <a class="nav-link" asp-area="Identity" asp-page="/Account/Login">登录</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" asp-area="Identity" asp-page="/Account/Register">注册</a>
        </li>
    </ul>
}